package com.backend.help.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.github.xiaoymin.knife4j.core.util.StrUtil;
import com.framework.dubbo.consumer.service.DubboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * 描述：
 * 文件转换服务，需要dubbo 服务启动
 * @author xianggj
 * @Date 2021/11/19 10:27
 **/
@RestController
@RequestMapping("fileCovert")
@ApiSort(3)
@Api(value = "文件转换html", tags="文件转换html")
public class FileConvertController {


    @Autowired
    private DubboService dubboService;

    @PostMapping("/toHtml")
    @ResponseBody
    @ApiOperation(value = "文件转换html",notes = "支持pdf，word,xlxs,ppt,等文本文件", httpMethod = "POST")
    public String encPassword(MultipartFile file) throws Exception {

        return dubboService.file2html(file.getInputStream(), file.getOriginalFilename());
    }
}
